<template>
	<sw-form-frame v-model="visible" :title="formName" width="540" :type="formType" :loading="btnLoading" footer @submit="handleSubmitForm()">
		<el-form ref="form" size="medium" :model="formData" :rules="formRules" label-width="80px" v-loading="loading">
			<el-form-item label="按钮名称" prop="name">
				<el-input type="input" v-model="formData.name"></el-input>
			</el-form-item>
			<el-row :gutter="16">
				<el-col :span="13">
					<el-form-item label="按钮类别" prop="type">
						<sw-dict-select v-model="formData.type" dict-name="DISK_ROLE_BUTTON_TYPE" placeholder="按钮类别"></sw-dict-select>
					</el-form-item>
				</el-col>
				<el-col :span="11">
					<el-form-item label="排序" prop="sort" label-width="60px">
						<el-input-number v-model="formData.sort" controls-position="right" :min="1" style="width: 100%"></el-input-number>
					</el-form-item>
				</el-col>
			</el-row>
			<el-form-item label="描述" prop="content">
				<el-input type="textarea" v-model="formData.content"></el-input>
			</el-form-item>
			<el-form-item label="默认选中" prop="isSelect">
				<el-switch v-model="formData.isSelect" active-value="1" inactive-value="2"></el-switch>
			</el-form-item>
		</el-form>
	</sw-form-frame>
</template>

<script>
import formMixins from '@/mixins/formMixins';
import { queryLibraryButton, addedLibraryButton, updateLibraryButton } from '@/api/platform/tbRoleButton';
export default {
	mixins: [formMixins],
	data() {
		return {
			formName: '库按钮',
			formRules: {
				name: [{ required: true, message: '请输入按钮名称', trigger: 'blur' }],
				type: [{ required: true, message: '请选择按钮类型', trigger: 'change' }]
			}
		};
	},
	computed: {
		detailData() {
			return eval(queryLibraryButton);
		},
		callFunction() {
			return eval(this.addOrEdit ? addedLibraryButton : updateLibraryButton);
		}
	},
	methods: {}
};
</script>
